00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _numeric_type_check_hpp_
00027 #define _numeric_type_check_hpp_
00028
00029 #include <boost/mpl/vector.hpp>
00030 #include <boost/mpl/find.hpp>
00031 #include <boost/mpl/if.hpp>
00032 #include <boost/type_traits/is_same.hpp>
00033
00034 #include <gridpack/utilities/complex.hpp>
00035
00036 namespace gridpack {
00037 namespace math {
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 template <typename T>
00048 struct TypeCheck {
00049 private:
00050 typedef boost::mpl::vector<RealType, ComplexType> Allowable;
00051 typedef boost::mpl::end<Allowable>::type NotFound;
00052 typedef typename boost::mpl::find<Allowable, T>::type Found;
00053 public:
00054 typedef boost::mpl::not_<
00055 boost::is_same<Found, NotFound>
00056 > OK;
00057 static const bool check = OK::value;
00058 static const bool isComplex = boost::is_same<T, ComplexType>::value;
00059 template <typename Other>
00060 struct isSame : boost::is_same<T, Other>::type
00061 {};
00062 };
00063
00064 }
00065 }
00066
00067
00068
00069
00070 #endif